www.gusucode.com > 6KBBS ASP版 V7.1 > 6KBBS ASP版 V7.1\code\bbs\adminbd3.asp

    <!--#include file="up.asp"-->
<!--#include file="inc/page.asp"-->
<%
dim action,topicids,chooseaction,sql,ids,userids,rs1,comeurl
dim usedtable
usedtable=application(prefix&"usedtable")
usedtable=split(usedtable,"|")
action=request.querystring("action")
comeurl=Request.ServerVariables("HTTP_REFERER")

if usertype<3 or (usertype=3 and instr("|"&adminbd&"|","|"&bd&"|")=0) then
	tl=" 操 作 失 败"
	mes="<b>对不起!权限不够。</b>"
	call sendinfo(tl,mes)
	call down
	response.end
end if
if action="openquickgl" then
	Response.cookies(prefix&"2")("quickgl")=1
	response.redirect comeurl
elseif action="closequickgl" then
	Response.cookies(prefix&"2")("quickgl")=2
	response.redirect comeurl
end if
%><SCRIPT src=inc/menu.js></script>
<div class=adminbdlan><a href="adminbd.asp?bd=<%=bd%>&action=gonggao">发布公告</a> | <a href="adminbd.asp?bd=<%=bd%>&action=gonggaogl">公告管理</a><%if bdtype=3 then%> | <a href="adminbd.asp?action=passuser&bd=<%=bd%>"> 认证用户</a><%end if%> | <a href="adminbd2.asp?action=recycle&bd=<%=bd%>">回 收 站</a></div>
<%



chooseaction=checknum(request.form("chooseaction"))
topicids=request.form("topicids")
ids=""
userids="0"


function umark(markn)
	dim uid,j,k,tuserid
	k=0
	uid=split(userids,",")
	set rs1=server.createobject("adodb.recordset")
	sql="Select userid,mark,del from [user] where userid in ("&userids&")"
	rs1.open sql,conn,1,3
		for i=1 to rs1.recordcount
			tuserid=rs1("userid")
			for j=k to ubound(uid)
				if tuserid=int(uid(j)) then
					k=k+1
					rs1("mark")=rs1("mark")+int(markn)
				end if
			next	
			if rs1("mark")<0 then
				rs1("del")=true
				application(prefix&"deluser")=application(prefix&"deluser")&"|"&rs1("userid")&"|"
			end if
			rs1.Update
			rs1.movenext
		next	
	rs1.close
	set rs1=nothing
end function

select case chooseaction
case 0
tl=" 操 作 失 败"
mes="<b>操作失败,请返回并选择要进行的操作。</b>"
call sendinfo(tl,mes)

case 1			'批量置顶
set rs=server.createobject("adodb.recordset")
sql="Select id,top,userid from [topic] where bd="&bd&" and [top]=0 and id in ("&topicids&")"
rs.open sql,conn,1,3
	for i=1 to rs.recordcount
		userids=userids&","&rs("userid")	'获得能够加分的用户id
		ids=ids&","&rs("id")				'帖子ID,测试使用
		
		rs("top")=1
		rs.Update
		rs.movenext
	next
rs.close
set rs=nothing
tl=" 置 顶 成 功"
mes="<b>置顶帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
umark(30)
call sendinfo(tl,mes)


case 2			'批量取消置顶
sql="update [topic] set [top]=0 where bd="&bd&" and [top]=1 and id in ("&topicids&")"
conn.execute(sql)
tl=" 取 消 置 顶 成 功"
mes="<b>成功取消置顶帖子,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
call sendinfo(tl,mes)


case 3			'批量精华
set rs=server.createobject("adodb.recordset")
sql="Select id,top,userid,type from [topic] where bd="&bd&" and [type]=0 and id in ("&topicids&")"
rs.open sql,conn,1,3
	for i=1 to rs.recordcount
		userids=userids&","&rs("userid")	'获得能够加分的用户id
		ids=ids&","&rs("id")				'帖子ID,测试使用
		
		rs("type")=1
		rs.Update
		rs.movenext
	next
rs.close
set rs=nothing
tl=" 设 定 成 功"
mes="<b>设定为精华帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
umark(50)
call sendinfo(tl,mes)


case 4			'批量取消精华
sql="update [topic] set [type]=0 where bd="&bd&" and [type]=1 and id in ("&topicids&")"
conn.execute(sql)
tl=" 设 定 成 功"
mes="<b>成功取消精华帖子,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
call sendinfo(tl,mes)

case 5			'锁定
sql="update [topic] set [type]=2 where bd="&bd&" and [type]<>2 and id in ("&topicids&")"
conn.execute(sql)
tl=" 锁 定 成 功"
mes="<b>锁定帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
call sendinfo(tl,mes)


case 6			'解锁
sql="update [topic] set [type]=0 where bd="&bd&" and [type]=2 and id in ("&topicids&")"
conn.execute(sql)
tl=" 解 锁 成 功"
mes="<b>解锁帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
call sendinfo(tl,mes)

case 7			'删除帖子
set rs=server.createobject("adodb.recordset")
sql="Select id,top,userid,type from [topic] where bd="&bd&" and [top]<>2 and id in ("&topicids&")"
rs.open sql,conn,1,3
	for i=1 to rs.recordcount
		userids=userids&","&rs("userid")
		ids=ids&","&rs("id")	
		rs("type")=3
		rs.Update
		rs.movenext
	next
rs.close
set rs=nothing
if len(ids)>0 then
	ids=right(ids,len(ids)-1)
	for i=1 to ubound(usedtable)
		sql="update bbs"&usedtable(i)&" set type=3 where id in("&ids&")"
		conn.execute(sql)
	next
end if

tl=" 删 除 成 功"
mes="<b>删除帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
umark(-30)
call sendinfo(tl,mes)

%>

<%case 8
if action="" then
%>
<script>
function changelist(){
var choosename=document.getElementsByName("bd").item(0);
var chooseint=choosename.selectedIndex;
var choosevalue=choosename.options[chooseint].value;
if(choosevalue==0){
	alert("不能选择分类,只能选择版面!");
	choosename.options[0].selected=true;
	return false;
}

}
</script>
<form method="POST" action="adminbd3.asp?action=moveok&bd=<%=bd%>" onsubmit="return changelist();">
<input type="hidden" name="topicids" size="10" value="<%=topicids%>"><input type="hidden" name="chooseaction" size="10" value="<%=chooseaction%>">
<div class=adminbdtitle>移动帖子</div><div class=adminbdbody><p style="margin:8px;">请选择帖子要移动到的版面:
<%
set rs=conn.execute("select * from bdinfo where followid=0 order by orders desc,id")
	response.write"<select size=1 name=bd><option value=0>请选择版面</option>"
	do while not rs.eof
		response.write"<option value=0 style='background-color:#e5e5e5;'>┏ "&split(rs("bdinfo"),"|")(0)&"</option>"
		set rs1=conn.execute("select * from bdinfo where followid="&rs("id")&" order by orders desc,id")
			do while not rs1.eof
				response.write"<option value="&rs1("id")&">┠ "&split(rs1("bdinfo"),"|")(0)&"</option>"
				rs1.movenext
			Loop
		set rs1=nothing
		rs.movenext
	Loop
	response.write"</select>"
set rs=nothing
%>&nbsp; 
    <input type="submit" value="  移   动  " name="a"></p></div></form>
<%
elseif action="moveok" then
dim thisbbs
	thisbbs=checknum(request.form("bd"))
	if thisbbs=0 then
		tl=" 移 动 失 败"
		mes="<b>移动帖子失败,你没有选择版面。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。<br>·<a href='javascript:history.go(-1)'><img border=0 src="&styleid&"/re.gif align=absmiddle>返回重新选择</a>"
	else
		sql="update topic set bd="&thisbbs&" where bd="&bd&" and id in("&topicids&")"
		conn.execute(sql)
		for i=1 to ubound(usedtable)
			sql="update bbs"&usedtable(i)&" set bd="&thisbbs&" where bd="&bd&" and ((id in("&topicids&")) or (bid in("&topicids&")))"
			conn.execute(sql)
		next
		tl=" 移 动 成 功"
		mes="<b>移动帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
	end if
	call sendinfo(tl,mes)


end if
%>
<%
case 9			'提升
sql="update topic set edittime=now()+"&timeset&"/24 where bd="&bd&" and id in("&topicids&")"
conn.execute(sql)
tl=" 提 升 成 功"
mes="<b>提升帖子成功,请选择你要进行的操作。</b><br>·<a href=topiclist.asp?bd="&bd&">回到"&bdinfo(0)&"</a>。"
call sendinfo(tl,mes)

%>
<%end select

call down%>